﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: TransactionItem. </summary>
	public partial class TransactionItemRelations
	{
		/// <summary>CTor</summary>
		public TransactionItemRelations()
		{
		}

		/// <summary>Gets all relations of the TransactionItemEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.ItemEntityUsingItemId);
			toReturn.Add(this.ShelfEntityUsingShelfId);
			toReturn.Add(this.StoreEntityUsingStoreId);
			toReturn.Add(this.TransactionEntityUsingTransactionId);
			return toReturn;
		}

		#region Class Property Declarations



		/// <summary>Returns a new IEntityRelation object, between TransactionItemEntity and ItemEntity over the m:1 relation they have, using the relation between the fields:
		/// TransactionItem.ItemId - Item.Id
		/// </summary>
		public virtual IEntityRelation ItemEntityUsingItemId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Item", false);
				relation.AddEntityFieldPair(ItemFields.Id, TransactionItemFields.ItemId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ItemEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between TransactionItemEntity and ShelfEntity over the m:1 relation they have, using the relation between the fields:
		/// TransactionItem.ShelfId - Shelf.Id
		/// </summary>
		public virtual IEntityRelation ShelfEntityUsingShelfId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Shelf", false);
				relation.AddEntityFieldPair(ShelfFields.Id, TransactionItemFields.ShelfId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ShelfEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between TransactionItemEntity and StoreEntity over the m:1 relation they have, using the relation between the fields:
		/// TransactionItem.StoreId - Store.Id
		/// </summary>
		public virtual IEntityRelation StoreEntityUsingStoreId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Store", false);
				relation.AddEntityFieldPair(StoreFields.Id, TransactionItemFields.StoreId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between TransactionItemEntity and TransactionEntity over the m:1 relation they have, using the relation between the fields:
		/// TransactionItem.TransactionId - Transaction.Id
		/// </summary>
		public virtual IEntityRelation TransactionEntityUsingTransactionId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "Transaction", false);
				relation.AddEntityFieldPair(TransactionFields.Id, TransactionItemFields.TransactionId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionItemEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticTransactionItemRelations
	{
		internal static readonly IEntityRelation ItemEntityUsingItemIdStatic = new TransactionItemRelations().ItemEntityUsingItemId;
		internal static readonly IEntityRelation ShelfEntityUsingShelfIdStatic = new TransactionItemRelations().ShelfEntityUsingShelfId;
		internal static readonly IEntityRelation StoreEntityUsingStoreIdStatic = new TransactionItemRelations().StoreEntityUsingStoreId;
		internal static readonly IEntityRelation TransactionEntityUsingTransactionIdStatic = new TransactionItemRelations().TransactionEntityUsingTransactionId;

		/// <summary>CTor</summary>
		static StaticTransactionItemRelations()
		{
		}
	}
}
